#include "widget.h"
#include "ui_widget.h"
#include "thread.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 创建两线程
    QThread thread1;
    QThread thread2;

    // 线程，启动！
    thread1.start();
    thread2.start();

    // 线程等待，主线程等待 两线程结束
    thread1.wait();
    thread2.wait();

    // 输出结果
    qDebug() << Thread::num;
}

Widget::~Widget()
{
    delete ui;
}

